namespace NBody.Analysis
{
    using System;
    using DataFile;
    
    public class EnergyBinDMDE : EnergyBin
    {
        public override void Analyse(NBodySystem s)
        {
            Console.Error.WriteLine("Calculating dM/dE");
            
            energy_bin_normal(s, new Function(mass));
            
            double deltaE = data[1, 0] - data[0, 0];
            for (int i = 0; i  < data.Length; i++)
                data[i, 1] /= deltaE;
        }
        
        private double mass(Particle p)
        {
            return p.Mass;
        }
    }
}
